package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.domain.SmsFlashPromotionProductRelation;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 商品限时购与商品关系表 Mapper 接口
 * </p>
 *
 * @author zaxingli
 * @since 2022-11-09
 */
public interface SmsFlashPromotionProductRelationMapper extends BaseMapper<SmsFlashPromotionProductRelation> {
    //获取商品数量
    @Select("SELECT DISTINCT flash_promotion_session_id,  COUNT(DISTINCT (product_id)) productCount  FROM sms_flash_promotion_product_relation WHERE flash_promotion_id=#{flashPromotionId}  GROUP BY flash_promotion_session_id;")
    List<Map<String, String>> findProductCount(Integer flashPromotionId);

}
